import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FoodServiceVO, FoodServiceForm, FoodServiceQuery } from '@/api/nursing/foodService/types';

/**
 * 查询饮食服务列表
 * @param query
 * @returns {*}
 */

export const listFoodService = (query?: FoodServiceQuery): AxiosPromise<FoodServiceVO[]> => {
  return request({
    url: '/nursing/foodService/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询饮食服务详细
 * @param serviceId
 */
export const getFoodService = (serviceId: string | number): AxiosPromise<FoodServiceVO> => {
  return request({
    url: '/nursing/foodService/' + serviceId,
    method: 'get'
  });
};

/**
 * 新增饮食服务
 * @param data
 */
export const addFoodService = (data: FoodServiceForm) => {
  return request({
    url: '/nursing/foodService',
    method: 'post',
    data: data
  });
};

/**
 * 修改饮食服务
 * @param data
 */
export const updateFoodService = (data: FoodServiceForm) => {
  return request({
    url: '/nursing/foodService',
    method: 'put',
    data: data
  });
};

/**
 * 删除饮食服务
 * @param serviceId
 */
export const delFoodService = (serviceId: string | number | Array<string | number>) => {
  return request({
    url: '/nursing/foodService/' + serviceId,
    method: 'delete'
  });
};
